/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.hauntedhouses.util;

import cz.muni.fi.hauntedhouses.entity.Authorities;
import cz.muni.fi.hauntedhouses.entity.Users;
import cz.muni.fi.hauntedhouses.to.AuthoritiesTO;
import cz.muni.fi.hauntedhouses.to.UsersTO;

/**
 *
 * @author honzaq
 */
public class AuthoritiesUtil {
    public static AuthoritiesTO entityToTO(Authorities role) {
        if (role == null) {
            return null;
        }
        
        AuthoritiesTO roleTo = new AuthoritiesTO();
        roleTo.setId(role.getId());
        roleTo.setAuthority(role.getAuthority());
        roleTo.setUsername(role.getUsername());
        
        return roleTo;
    }
    
    public static Authorities TOToEntity(AuthoritiesTO roleTo) {
        if (roleTo == null) {
            return null;
        }
        
        Authorities role = new Authorities();
        role.setId(roleTo.getId());
        role.setAuthority(roleTo.getAuthority());
        role.setUsername(roleTo.getUsername());
        
        return role;
    }
}
